package com.woniu.controller;

import com.woniu.common.BaseForm;
import com.woniu.form.OpenRedPacketForm;
import com.woniu.service.RedPacketService;
import com.woniu.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Description:
 * @Author: woniu
 * @date: 2023/12/27 11:38
 */
@RestController("RedPacketController")
@RequestMapping("/redPacket")
@Api(tags = "红包")
public class RedPacketController {

    @Autowired
    private RedPacketService redPacketService;


    @ApiOperation(value = "抢红包")
    @PostMapping("/snatch")
    @ApiImplicitParams({})
    public SnatchRedPacketVO snatchRedPacket(){
        return redPacketService.snatchRedPacket();
    }


//    @ApiOperation(value = "开红包")
//    @PostMapping("/open")
//    @ApiImplicitParams({})
//    public boolean openRedPacket(@RequestBody @Valid OpenRedPacketForm form){
//        return redPacketService.openRedPacket(form);
//    }


    @ApiOperation(value = "红包列表")
    @GetMapping("/list")
    @ApiImplicitParams({})
    public RedPacketVO list(BaseForm form){
        return redPacketService.redPacketList(form);
    }

    @ApiOperation(value = "红包概况")
    @GetMapping("/remain")
    @ApiImplicitParams({})
    public RedPacketExistVO remainRedPacket(){
        return redPacketService.remainRedPacket();
    }

    @ApiOperation(value = "红包规则文案")
    @GetMapping("/regulation")
    @ApiImplicitParams({})
    public SysConfigRegulationVO regulation(){
        return redPacketService.regulation();
    }

//    @ApiOperation(value = "测试接口")
//    @GetMapping("/test")
//    @ApiImplicitParams({})
//    public void test(){redPacketService.test();};



}
